home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7582 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: news-m01.ny.us.ibm.net!usenet
  2. From: hopkinc@ibm.net
  3. Newsgroups: comp.lang.pl1,comp.lang.c
  4. Subject: Re: PL/I and C
  5. Date: 27 Feb 1996 15:38:08 GMT
  6. Message-ID: <4gv8h0$3o2k@news-s01.ny.us.ibm.net>
  7. References: <4gh5ru$eng@goanna.cs.rmit.EDU.AU> <312CCEB2.4AB7@corp.dialog.com> <4grhtv$s31@goanna.cs.rmit.EDU.AU> <4gt0tv$826@solutions.solon.com>
  8. Reply-To: Chris_harlow@artemis-intl.com
  9. NNTP-Posting-Host: slip139-92-21-67.lo.uk.ibm.net
  10. X-Newsreader: IBM NewsReader/2 v1.2
  11.  
  12. In <4gt0tv$826@solutions.solon.com>, seebs@solutions.solon.com (Peter Seebach) writes:
  13.  
  14. >Yes, C's string handling is primitive.  It also has no hidden overhead.
  15.  
  16. I'm sure you know C better than me but I know enough C to refute your
  17. statement... for example:
  18.  
  19. (1) The PL/1 equivalent of strlen() requires only a single load instruction.
  20.       Wheres the 'hidden overhead'... you guessed it, its in the C library!
  21.  
  22. (2) My processor has a  move-n-bytes instruction.
  23.      When I assign a string to a string in PL/1 the compiler knows in advance
  24.     WITHOUT OVERHEAD how many bytes it is going to have to move and simply
  25.     generates the required single instruction.  (even on cpus without move-n-bytes
  26.     instructions, I have seen PL/1 generated code that performed 4-byte move
  27.     instructions or load/stores until it was within 3 bytes of the end of the string..
  28.     this is far more intelligent than having to check every byte for null..)
  29.  
  30.    Many have pointed out that C is rather lower level than PL/1 and I dont think
  31.    anyone would disagree. My point is that the C language is sometimes at a 
  32.    lower level than my processors machine code... this puts extra load in the 
  33.    C string library... 
  34.  
  35.  SO I think a better statement would have been:
  36.    Yes, C's string handling is primitive AND it contains hidden overhead. 
  37.  
  38.